Fixed JavaScript Warning - Pin to Top of Page Using CSS Position [migrated]
Posted
by
nicorellius
on Pro Webmasters
See other posts from Pro Webmasters
or by nicorellius
Published on 2012-06-25T17:30:50Z
Indexed on
2012/06/25
21:24 UTC
Read the original article
Hit count: 436
I am new to this site, but it seems like the right place to ask this question. I am working on a noscript
chunk of code whereby I do some stuff that includes a <p>
at the top of the page that alerts the users that he/she has JavaScript disabled.
The end result should look like the Stack Exchange sites when JavaScript is disabled (here is a screenshot of mine - SE looks similar except it is at the very top of the page):
I have it working OK, but I would love it if the red bar stayed fixed along the top, upon scrolling.
I tried using the position: fixed;
method, but it ends up moving the p
element and I can't get it to look exactly the same as it does without the position: fixed;
modification. I tried fiddling with CSS top
and left
and other positioning but it doesn't ever look like I want it to.
Here is a CSS snippett:
<noscript>
<style type="text/css">
p. noscript_warning {
position: fixed;
}
</noscript>
© Pro Webmasters or respective owner